﻿Public Class TB_PRUEBA_DISENO_SECCION

    Public Shared Sub ACTUALIZA_PRUEBA_DISENNO_SECCION _
        ( _
         ByRef Rp As DotNetResponse.SQLPersistence, _
         ByRef Exec As DotNetDal.SQLPersistence, _
         ByVal ID_SECCION As Long, _
         ByVal NOMBRE_SECCION As String, _
         ByVal PUNTOS As Integer, _
         ByVal usuario As String, _
         ByVal Observacion As String _
         )

        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        Rpexec.StoredProcedure = "SP_ACTUALIZA_PRUEBA_DISENNO_SECCION"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(True, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If

        Rpexec.AddParametro(ID_SECCION)
        Rpexec.AddParametro(NOMBRE_SECCION)
        Rpexec.AddParametro(PUNTOS)
        Rpexec.AddParametro(Observacion)

        Exec.ExecuteNonQuery(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError

    End Sub
    Public Shared Sub CREAR_PRUEBA_DISENNO_SECCION _
        ( _
        ByRef Rp As DotNetResponse.SQLPersistence, _
        ByRef Exec As DotNetDal.SQLPersistence, _
        ByVal ID_SECCION As Long, _
        ByVal FK_PRUEBA As Long, _
        ByVal NOMBRE_SECCION As String, _
        ByVal PUNTOS As Integer, _
        ByVal usuario As String, _
        ByVal Observacion As String _
         )

        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        Rpexec.StoredProcedure = "SP_CREAR_PRUEBA_DISENNO_SECCION"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(True, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If

        Rpexec.AddParametro(ID_SECCION)
        Rpexec.AddParametro(FK_PRUEBA)
        Rpexec.AddParametro(NOMBRE_SECCION)
        Rpexec.AddParametro(PUNTOS)
        Rpexec.AddParametro(Observacion)
        Rpexec.AddParametro(usuario)

        Exec.ExecuteScalar(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.GetScalar = Rpexec.GetScalar
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub
    Public Shared Sub ELIMINA_PRUEBA_DISENNO_SECCION(ByRef Rp As DotNetResponse.SQLPersistence, ByRef Exec As DotNetDal.SQLPersistence, ByVal ID_SECCION As Long, ByVal usuario As String)
        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        Rpexec.StoredProcedure = "SP_ELIMINA_PRUEBA_DISENNO_SECCION"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(True, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If
        Rpexec.AddParametro(ID_SECCION)

        Exec.ExecuteNonQuery(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.GetScalar = Rpexec.GetScalar
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub
    Public Shared Sub SELECCIONA_PRUEBA_DISENNO_SECCION_PK(ByRef Rp As DotNetResponse.SQLPersistence, _
                                                           ByRef Exec As DotNetDal.SQLPersistence, _
                                                           ByVal ID_SECCION As Long, _
                                                           ByVal usuario As String)
        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        'Rpexec.StoredProcedure = "SP_SELECCIONA_PRUEBA_DISENNO_SECCION_PK"
        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(False, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If
        Rpexec.AddParametro(ID_SECCION)
        Exec.ExecuteScalar(Rpexec)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.DtTable = Rpexec.DtTable
        Rp.Errores = Rpexec.Errores
        Rp.MensajeError = Rpexec.MensajeError
    End Sub

    Public Shared Sub SELECCIONA_PRUEBA_DISENNO_SECCION_FK(ByRef Rp As DotNetResponse.SQLPersistence, ByRef Exec As DotNetDal.SQLPersistence, ByVal FK_PRUEBA As Long, ByVal usuario As String)
        Dim LocalCommit As Boolean = False
        Dim Rpexec As New DotNetResponse.SQLPersistence
        'Rpexec.StoredProcedure = "SP_SELECCIONA_PRUEBA_DISENNO_SECCION_FK"

        If Exec Is Nothing Then
            Exec = New DotNetDal.SQLPersistence(False, "cnn", DotNetDal.SQLPersistence.Provider.SQLCLIENT)
            LocalCommit = True
        End If

        Dim csql As String = "select P_SECCION,S_NOMBRE_SECCION , I_PUNTOS ,I_NRO_SECCION, s_observacion,S_VIGENTE   from TB_PRUEBA_DISENO_SECCION where k_PRUEBA =" & FK_PRUEBA

        'Rpexec.AddParametro(FK_PRUEBA)

        Exec.ExecuteDataTable(Rpexec, csql)
        If LocalCommit Then
            Exec.Commit()
            Exec.Dispose()
        End If

        Rp.MensajeError = Rpexec.MensajeError
        Rp.DtTable = Rpexec.DtTable
        Rp.Errores = Rpexec.Errores

    End Sub


End Class
